<template>
  <!-- 双优化电子审批明细表(本月审批通过) -->
   <a-table class="takeOut-hover" :columns="columns" bordered :pagination="false" :data-source="tableData">
   <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record,index">
       {{noValue(record[col.dataIndex],index,col.dataIndex)}}
     </template>
  </a-table>
</template>
<script>
import { summaryMixin } from "./mergeCell";
export default {
  mixins:[summaryMixin], //混入文件
  name: 'a' + Date.now(),
  props: {
    tableData: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    this.columns = [
      { title: '序号',align: 'center',dataIndex: 'serial', width:'4%',scopedSlots: { customRender: 'serial' } },
      {
        title: '所属分公司',
        align: 'center',
        dataIndex: 'branchComId',
        ellipsis: true,
        width:'16%',
        customRender: (value, row, index) => { 
          const obj = {
            children: row.branchComName||'/',
            attrs: {}
          }
          obj.attrs.rowSpan = this.mergeCellKey(row.branchComId, this.tableData, 'branchComId');
          if(index === this.tableData.length-1){
              obj.attrs.colSpan = 2;
              obj.children = '总合计';
          }
          //console.log(obj,'obj')
          return obj
        }
      },
      { title: '所属项目名称', align: 'center', dataIndex: 'projectName', width:'16%',scopedSlots: { customRender: 'projectName' },
         customRender: (value, row, index) => { 
          const obj = {
            children: row.projectName,
            attrs: {}
          }
          if(index === this.tableData.length - 1){
           obj.attrs.colSpan = 0;
          }
          
          return obj
        }
      
      },
      { title: '双优化项目名称', dataIndex: 'doubleOptName', align: 'center', ellipsis: true,  width:'16%',scopedSlots: { customRender: 'doubleOptName' }},
      { title: '优化类型', dataIndex: 'optTypeName', align: 'center', ellipsis: true, width:'16%',scopedSlots: { customRender: 'optTypeName' }},
      { title: '优化效益额（万元）', dataIndex: 'optFee', align: 'center', ellipsis: true, width:'16%',scopedSlots: { customRender: 'optFee' }},
      { title: '计划实施时间', dataIndex: 'planTime', align: 'center', ellipsis: true, width:'16%',scopedSlots: { customRender: 'planTime' }},
    ]
    return {
    }
  },
  methods: {
  },
  mounted() {
  }
}
</script>
<style lang="less">
</style>
